#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int d = 0, m = 0, c = 0, a = 0;
    float  val = 0.0, v = 0.0;
    scanf("%f %d %d %d", &val, &d, &m, &c);
    if (c)
        a = 50;
    if (d == 11 && m == 11)
        v = val * 0.7 - a;
    else  if (d == 12 && m == 12)
        v = val * 0.8 - a;
    if (v < 0)
        printf("0.00\n");
    else
        printf("%.2f\n", v);
    return 0;
}